package com.learn.hibernatevalidator.chapter07.valueextractor.valueextractor;

import jakarta.validation.valueextraction.ExtractedValue;
import jakarta.validation.valueextraction.ValueExtractor;

import java.util.Optional;

/**
 * @author: liyf
 * @create: 2025-01-18 22:45
 **/
public class OptionalValueExtractor implements ValueExtractor<Optional<@ExtractedValue ?>> {

    @Override
    public void extractValues(Optional<?> originalValue, ValueReceiver receiver) {

        receiver.value(null, originalValue.orElse(null));
    }
}
